package com.insigma.yanwenlong.bookkeeping.util;

import java.sql.Date;

public class GetDateYearOrMonth {
	public static int getDateMonth(Date date) {
		String monthString = date.toString().substring(5, 7);
		int month = Integer.parseInt(monthString);
		return month;
	}
	
	public static int getDateYear(Date date) {
		String yearString = date.toString().substring(0, 4);
		int year = Integer.parseInt(yearString);
		return year;
	}
	
//	public static void main(String[] args) {
//		System.out.println(getDateMonth(StringToDate.getDate("2013-2-3")));
//		System.out.println(getDateYear(StringToDate.getDate("2013-2-13")));
//	}
}
